package view.components
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.geom.Rectangle;
	import flash.text.TextField;
	
	import utils.TextTool;
	
	import view.face.Hint;
	import global.Resource;

	public class InfoBar extends Sprite
	{
		private var bg:DisplayObject;
		private var text:TextField;
		private var tempText:TextField;
		
		public function InfoBar()
		{
			this.mouseChildren = false;
			initBg();
			initText();
		}
		
		private function initText():void
		{
			text = TextTool.getTextField(100,30,13,0,false,false);
			text.x = 10;
			text.y = 5;
			text.mouseEnabled = false;
			addChild(text);
			
			tempText = TextTool.getTextField(500,30,13,0,false,false);
		}
		
		private function initBg():void
		{
			bg = Resource.getShape("buble");
			addChild(bg);
		}
		
		public function update(content:String):void
		{
			tempText.text = content;
			bg.width = tempText.textWidth + 40;
			text.width = this.width - 10;
			text.text = content;
			
		}
	}
}